package chucnang;


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;

import trangchu.TrangChu;

public class MenuAction_MuaHang extends JPopupMenu implements ActionListener {
	private JMenuItem itemAdd,itemDel,itemEdit,itemNew,itemXem,itemDong;
	private MuaHang muahang;
	private TrangChu trangchu;
	public MenuAction_MuaHang(TrangChu trangchu){
		this.trangchu = trangchu;
		this.initMenu();		
	}
	private void initMenu(){	
		this.itemNew = new JMenuItem("Tạo Mới",new ImageIcon("images/new.gif"));
		this.itemAdd = new JMenuItem("Thêm",new ImageIcon("images/them.gif"));		
		this.itemEdit= new JMenuItem("Sửa",new ImageIcon("images/sua.gif"));
		this.itemDel = new JMenuItem("Xóa",new ImageIcon("images/xoa.gif"));		
		this.itemXem = new JMenuItem("Xem",new ImageIcon("images/xem.gif"));
		this.itemDong = new JMenuItem("Đóng",new ImageIcon("images/dong.gif"));
		
		this.add(this.itemNew);
		this.add(this.itemAdd);
		this.add(this.itemEdit);
		this.add(this.itemDel);		
		this.add(this.itemXem);
		this.add(this.itemDong);
		
		this.itemNew.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,KeyEvent.CTRL_MASK));
		this.itemAdd.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T,KeyEvent.CTRL_MASK));
		this.itemEdit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E,KeyEvent.CTRL_MASK));
		this.itemDel.setAccelerator(KeyStroke.getKeyStroke("DELETE"));
		this.itemXem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M,KeyEvent.CTRL_MASK));
		this.itemDong.setAccelerator(KeyStroke.getKeyStroke("F10"));
		
		this.itemNew.addActionListener(this);
		this.itemAdd.addActionListener(this);
		this.itemEdit.addActionListener(this);
		this.itemDel.addActionListener(this);
		this.itemXem.addActionListener(this);
		this.itemDong.addActionListener(this);
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == itemDong){
			
		}
	}
}
